#pragma once

#include "d3d9.h"
#include "d3dx9.h"
#include <vector>

// Add pragma comments so you do not have to change
// the property dependencies
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

struct s_Sprite
{
	IDirect3DTexture9*	m_pD3DTexture;
	D3DXIMAGE_INFO		m_ImageInfo;
	D3DXVECTOR3			vecPos;
	D3DXVECTOR3			vecRot;
	D3DXVECTOR3			vecCenter;
	float				fScale;
	D3DCOLOR			color;
};

class SpriteManager
{
private:
	// Singleton instance
	static SpriteManager*	m_SpriteInstance;
	// Sprite object
	ID3DXSprite*			m_pD3DSprite;
	// Pointer to the D3D Device
	IDirect3DDevice9*		m_Device;
	// Sprite index to travers through the vector
	short					sSpriteIndex;
	// Create the vector to hold the sprites
	std::vector<s_Sprite*> spriteList;

public:
	SpriteManager(void);
	~SpriteManager(void);

	// Singleton instance
	static SpriteManager* GetInstance(void);
	void DeleteSpriteInstance(void);

	void InitSpriteManager(IDirect3DDevice9* m_pD3DDevice);
	short LoadSprite(LPCSTR spriteFilename, D3DXVECTOR3 vecPos, float fScale);
	void DrawSprite(short sSpriteID);
	void ModifySpritePos(short sSpriteID, float fXChange, float fYChange);
	void ModifySpriteRot(short sSpriteID, float fZChange);
	bool SpriteCollision(short sSpriteID, POINT pMousePoint);
	short GetSpriteCount();

	// Shutdown functions
	void DestroySprite(short sSpriteID);
	void DestroyAllSprites(void);
	void ShutdownDevice(void);
};
